package br.com.javajsf.modelo;

import java.io.Serializable;
import java.sql.Date;



public class Pagamento implements Serializable {

	private static final long serialVersionUID = -3666110850261073813L;
	private int cod;
	private Date dataPag;
	private double valor;
	private Cliente cliente;
	
	public Pagamento(){
		setCliente(new Cliente());
	}
	public Pagamento(Cliente cliente, Date dataPag, double valor){
		this.setCliente(cliente);
		this.dataPag = dataPag;
		this.valor = valor;
	}
	
	//Getters and Setters
	public Date getDataPag() {
		return dataPag;
	}
	public void setDataPag(Date dataPag) {
		this.dataPag = dataPag;
	}
	public double getValor() {
		return valor;
	}
	public void setValor(double valor) {
		this.valor = valor;
	}
	public Cliente getCliente() {
		return cliente;
	}
	public void setCliente(Cliente cliente) {
		this.cliente = cliente;
	}
	public int getCod() {
		return cod;
	}
	public void setCod(int cod) {
		this.cod = cod;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((cliente == null) ? 0 : cliente.hashCode());
		result = prime * result + cod;
		result = prime * result + ((dataPag == null) ? 0 : dataPag.hashCode());
		long temp;
		temp = Double.doubleToLongBits(valor);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Pagamento other = (Pagamento) obj;
		if (cliente == null) {
			if (other.cliente != null)
				return false;
		} else if (!cliente.equals(other.cliente))
			return false;
		if (cod != other.cod)
			return false;
		if (dataPag == null) {
			if (other.dataPag != null)
				return false;
		} else if (!dataPag.equals(other.dataPag))
			return false;
		if (Double.doubleToLongBits(valor) != Double
				.doubleToLongBits(other.valor))
			return false;
		return true;
	}
	@Override
	public String toString() {
		return "Pagamento [cod=" + cod + ", dataPag=" + dataPag + ", valor="
				+ valor + ", cliente=" + cliente + "]";
	}
	
	
	
	
}
